$(function(){
	//刷新浏览器是更新页面数据
	if($('input[name=buytype]:checked').val()=='1'){
		var str ='';
		str += '<tr class="hdfk"><td width="720px;"></td><td width="120px;">货到付款手续费：</td><td width="100px;">￥<span>10.00</span></td></tr>';
		$('tr.gspsum').after(str);
		var rp = parseInt($('.ap').text().replace(',','')) + parseInt($('input[name=transporttype]:checked').attr('tp')) + 10;
		$('.rp').html(rp + '.00');
	}else{
		var rp = parseInt($('.ap').text().replace(',','')) + parseInt($('input[name=transporttype]:checked').attr('tp'));
		$('.rp').html(rp + '.00');
	}
	if($('input[name=transporttype]:checked').val()=='1'){
		$('.tp').html('15.00');
	}else{
		$('.tp').html('20.00');
	}

	var payPrice = 0;
	var transportPrice = 0;
	//判断选择的支付方式
	$('input[name=buytype]').click(function(){
		if($(this).attr('value') == '1'){
			payPrice += parseInt($(this).attr('pp'));
			var str = '';
			str += '<tr class="hdfk"><td width="720px;"></td><td width="120px;">货到付款手续费：</td><td width="100px;">￥<span>10.00</span></td></tr>';
			$('tr.gspsum').after(str);
			var rp = parseInt($('.ap').text().replace(',','')) + parseInt($('input[name=transporttype]:checked').attr('tp')) + payPrice;
			$('.rp').html(rp + '.00');
		}else{
			payPrice = 0;
			$('tr.hdfk').remove();
			var rp = parseInt($('.ap').text().replace(',','')) + parseInt($('input[name=transporttype]:checked').attr('tp')) + payPrice;
			$('.rp').html(rp + '.00');
		}
	});
	//判断选择的快递方式
	$('input[name=transporttype]').click(function(){
		if($(this).attr('value')=='1'){
			transportPrice = 0;
			transportPrice += parseInt($(this).attr('tp'));
			$('.tp').html(transportPrice + '.00');
			var rp = parseInt($('.ap').text().replace(',','')) + transportPrice + payPrice;
			$('.rp').html(rp + '.00');
		}else if($(this).attr('value')=='2'){
			transportPrice = 0;
			transportPrice += parseInt($(this).attr('tp'));
			$('.tp').html(transportPrice + '.00');
			var rp = parseInt($('.ap').text().replace(',','')) + transportPrice + payPrice;
			$('.rp').html(rp + '.00');
		}
	});
});